home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / hdparm.preinst < prev    next >
Text File  |  2009-10-06  |  3KB  |  72 lines

  1. #!/bin/sh
  2. set -e
  3.  
  4. # Remove a no-longer used conffile
  5. rm_conffile() {
  6.     CONFFILE="$1"
  7.  
  8.     if [ -e "$CONFFILE" ]; then
  9.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  10.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  11.         if [ "$md5sum" != "$old_md5sum" ]; then
  12.             echo "Obsolete conffile $CONFFILE has been modified by you."
  13.             echo "Saving as $CONFFILE.dpkg-bak ..."
  14.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  15.         else
  16.             echo "Removing obsolete conffile $CONFFILE ..."
  17.             rm -f "$CONFFILE"
  18.         fi
  19.     fi
  20. }
  21.  
  22. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  23.   if dpkg --compare-versions "$2" le 6.1-6; then
  24.     if dpkg --compare-versions "$2" gt 6.1-2; then
  25.       for conffile in /etc/init.d/hdparm.dev /etc/dev.d/block//hdparm.block /etc/dev.d/block/hdparm.dev; do
  26.         [ ! -e "$conffile" ] || rm_conffile "$conffile"
  27.       done
  28.     elif dpkg --compare-versions "$2" lt 5.5-5; then
  29.       update-rc.d -f hdparm remove > /dev/null 2>&1
  30.       if dpkg --compare-versions "$2" lt 5.4-6; then
  31.         [ ! -e /etc/hdparm.conf ] || rm_conffile "/etc/hdparm.conf"
  32.         if dpkg --compare-versions "$2" ge 5.4-3; then
  33.           if [ -e /etc/default/hdparm ]; then  
  34.             echo -n "Moving old /etc/default/hdparm to /etc/hdparm.conf . . "
  35.             mv /etc/default/hdparm /etc/hdparm.conf
  36.             echo "done."
  37.           fi
  38.         fi
  39.       fi
  40.     fi
  41.   fi
  42.   if dpkg --compare-versions "$2" le-nl 9.15-1ubuntu3; then
  43.       if [ -L /etc/udev/rules.d/z60_hdparm.rules ]; then
  44.       rm -f /etc/udev/rules.d/z60_hdparm.rules
  45.       fi
  46.   fi
  47. fi
  48.  
  49. # Automatically added by dh_installudev
  50. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  51.     if [ -e "/etc/udev/rules.d/85_hdparm.rules" ]; then
  52.         if [ "`md5sum \"/etc/udev/rules.d/85_hdparm.rules\" | sed -e \"s/ .*//\"`" = \
  53.              "`dpkg-query -W -f='${Conffiles}' hdparm | sed -n -e \"\\\\' /etc/udev/rules.d/85_hdparm.rules '{s/ obsolete$//;s/.* //p}\"`" ]
  54.         then
  55.             rm -f "/etc/udev/rules.d/85_hdparm.rules"
  56.         fi
  57.     fi
  58. fi
  59. # End automatically added section
  60. # Automatically added by dh_installudev
  61. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  62.     if [ -e "/etc/udev/rules.d/85-hdparm.rules" ]; then
  63.         if [ "`md5sum \"/etc/udev/rules.d/85-hdparm.rules\" | sed -e \"s/ .*//\"`" = \
  64.              "`dpkg-query -W -f='${Conffiles}' hdparm | sed -n -e \"\\\\' /etc/udev/rules.d/85-hdparm.rules '{s/ obsolete$//;s/.* //p}\"`" ]
  65.         then
  66.             rm -f "/etc/udev/rules.d/85-hdparm.rules"
  67.         fi
  68.     fi
  69. fi
  70. # End automatically added section
  71.  
  72.